﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CMS.APP
{
    public class VoteOption
    {
        #region Fields
        /// <summary>
        /// 选项标题
        /// </summary>
        private string optionTitle;
        /// <summary>
        /// 选项标题
        /// </summary>
        public string OptionTitle
        {
            get { return optionTitle; }
            //set { optionTitle = value; }
        }
        /// <summary>
        /// 选项数量
        /// </summary>
        private decimal optionResult;
        /// <summary>
        /// 选项数量
        /// </summary>
        public decimal OptionResult
        {
            get { return optionResult; }
            //set { optionResult = value; }
        }
        /// <summary>
        /// 选项百分比
        /// </summary>
        private float optionPercent;
        /// <summary>
        /// 选项百分比
        /// </summary>
        public float OptionPercent
        {
            get { return optionPercent; }
            //set { optionPercent = value; }
        }
        #endregion Fields

        #region Constructor
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="optionTitle">选项标题</param>
        /// <param name="optionResult">选项结果</param>
        /// <param name="allResult">所有结果</param>
        public VoteOption(string optionTitle, decimal optionResult, decimal allResult)
        {
            this.optionTitle = optionTitle;
            this.optionResult = optionResult;
            this.optionPercent = (float)(optionResult / allResult);
            //小数位进位的算法
        }
        #endregion Constructor
    }
}
